﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SF.WebClient.Controllers
{
    public class BaseController : BasicController
    {
        public void ViewBaseCssSource()
        {
            this.WriteSourceCode("/Scripts/jquery-easyui-extensions/base/jeasyui.extensions.base.css");
        }

        #region Loading 遮罩层

        public ViewResult LoadingDemo()
        {
            return View();
        }

        public PartialViewResult LoadingSource()
        {
            return PartialView();
        }

        public void ViewLoadingSource()
        {
            //string url = Request.Url.AbsolutePath, path = string.Empty; bool fileExist = false;
            ////var a = JsSecurity.JsCaller.GetWindowSize();
            ////var b = JsSecurity.JsCaller.test1();
            ////JsSecurity.JsCaller.JScriptUtil();
            //if (!SourceCodeJpgInfoCache.TryGetValue(url, out path))
            //{
            //    this.SaveOriginalPageToImage();
            //    path = SourceCodeJpgInfoCache[url];
            //    fileExist = System.IO.File.Exists(path);
            //}
            //else
            //{
            //    //如果不在截屏状态 并且 缓存图片不存在的话，删除缓存，重新截屏
            //    if (!CaptureState)
            //    {
            //        fileExist = System.IO.File.Exists(Server.MapPath(path));
            //        if (!fileExist)
            //        {
            //            SourceCodeJpgInfoCache.Remove(url);
            //            SaveOriginalPageToImage();
            //            path = SourceCodeJpgInfoCache[url];
            //        }
            //    }
            //}

            //ViewBag.CaptureState = CaptureState;
            //ViewBag.Path = path;
            //ViewBag.Exist = fileExist;

            this.WriteSourceCode("/Scripts/jquery-easyui-extensions/base/jeasyui.extensions.base.loading.js");
        }

        public PartialViewResult LoadingExplain()
        {
            return PartialView();
        }

        #endregion

        #region IsEasyUI 判定是否已经是Easyui组件

        public ViewResult IsEasyUIDemo()
        {
            return View();
        }

        public PartialViewResult IsEasyUISource()
        {
            return PartialView();
        }

        public void ViewIsEasyUISource()
        {
            this.WriteSourceCode("/Scripts/jquery-easyui-extensions/base/jeasyui.extensions.base.isEasyUI.js");
        }

        public PartialViewResult IsEasyUIExplain()
        {
            return PartialView();
        }

        #endregion

        #region Tooltip 提示框

        public ViewResult TooltipDemo()
        {
            return View();
        }

        public PartialViewResult TooltipSource()
        {
            return PartialView();
        }

        public void ViewTooltipSource()
        {
            this.WriteSourceCode("/Scripts/jquery-easyui-extensions/base/jeasyui.extensions.base.tooltip.js");
        }

        public PartialViewResult TooltipExplain()
        {
            return PartialView();
        }

        #endregion

        #region Current 提示框

        public ViewResult CurrentDemo()
        {
            return View();
        }

        public PartialViewResult CurrentSource()
        {
            return PartialView();
        }

        public void ViewCurrentSource()
        {
            this.WriteSourceCode("/Scripts/jquery-easyui-extensions/base/jeasyui.extensions.base.current.js");
        }

        public PartialViewResult CurrentExplain()
        {
            return PartialView();
        }

        #endregion

        public void ClearCache()
        {
            SourceCodeJpgInfoCache.Clear();
        }
    }
}